<extend name="Base/common"/>
<block name="header">
    <include file="Public/nav"/>
</block>
<block name="body">
    <!--推荐模板部分-->
    <div class="container common-block templet">
        <section>
            <header>
                <h1>订单详情</h1>
            </header>


            <div style="padding:10px">

            </div>


            <div class="clearfix"></div>


            <div class="pd10">
                <table class="c_m_order_detail" style="width: 100%">
                    <tr style="background: #eee">
                        <td>订单编号：{$order.id}</td>
                        <td colspan="2">下单日期：{$order.create_time|friendlyDate}</td>
                        <td>订单状态：{$order.id|get_pay_condition}

                            <php>if(!$order['pay_ok'] && $order['status']){</php>

                            <a href="javascript:" data-role="cancel_order" data-id="{$order.id}" class="btn btn-xs btn-success">取消订单</a>

                            <script>
                                $(function(){
                                    $('[data-role="cancel_order"]').click(function(){
                                        if(confirm('确定要取消订单么？')){
                                            $.post("{:U('Appstore/index/cancelOrder')}",{id:$(this).attr('data-id')},function(res){
                                                handleAjax(res)
                                            })
                                        }
                                    })
                                })
                            </script>
                            <php>}</php>

                        </td>
                    </tr>


                    <tr>
                        <td colspan="2">

                         <a href="{:U('moduleDetail',array('id'=>$order['goods']['id']))}"
                               class="app_icon pull-left"><b></b>
                            {$order.goods.cover|display_cover}

                        </a>
                            <div class=" pull-left" style="padding-left: 30px;">
                            <h3 class="margin-top-0 "><a
                                    href="{:U('moduleDetail',array('id'=>$order['goods']['id']))}">{$order.goods.title}</a>
                            </h3>

                            <p class="disrip">{$order.goods.summary|text|mb_substr=0,20,'utf-8'}</p>

                            <p class="data">版本：{$order.version.title|display_version=true} 作者：
                                <empty name="goods.author">
                                    <a
                                            href="{$goods.user.space_url}">{$order.goods.user.nickname}</a>
                                    <else/>
                                    {$order.goods.author}
                                </empty>
                            </p>
                            </div>
                        </td>
                        <td>
                          价格：  {$order.score.title}   {$order.version_price} {$order.score.unit}

                        </td>
                        <td>
                            还需支付： {$order.score.title} <span style="color: red">{$order.payment_price}</span> {$order.score.unit}
                        </td>
                    </tr>

                </table>
            </div>

            <php>if(!$order['pay_ok']){</php>

            <div class="pull-right" style="padding-bottom: 20px;">

                <form action="__SELF__" method="post">
                    <input name="order_id" type="hidden"  value="{$order.id}">
                    <div class="pull-right"><input class="btn btn-primary" type="submit" value="支付"></div>
                </form>

            </div>


            <!--ping++和充值模块同时装的时候使用ping++-->
            <php>if(D('Module')->checkInstalled('Pingxx')){</php>

            <div class="pd10 clearfix">
                {:W('Pingxx/Pingxx/render',array('order_id'=>$order['id'],'ext'=>array('subject'=>'云市场-《'.$order['goods']['title'].'》') ))}
            </div>
            <php>}elseif(D('Module')->checkInstalled('Recharge')){</php>

            <div class="pd10 clearfix">
                {:W('Pay/pay',array('order_id'=>$order['id']))}
            </div>

            <php>}</php>



<php>}</php>
        </section>

    </div>

</block>
